package com.itlong.cloud.enumerate.ecode;


import lombok.Getter;
import lombok.Setter;

/**
 * 云对讲SDK错误码定义
 *
 * @createDate 2018/05/14
 */
public enum CloudTalkErrorCodeEnum {
    /*
    *mainCode为6表示云对讲SDK模块错误，subCode可用范围为1至999，其中1-100为云对讲SDK APP模块错误定义，101-999为服务端api错误定义；
   */
    USER_TOKEN_ERROR(6,1,"您的登录已过期，请重新登录"),
    APP_USER_EXISTS(6,97,"住户手机号不存在"),
    APP_SECRET_ERROR(6,98,"应用接入凭证错误"),
    APP_SIGN_ERR(6,99,"参数签名错误"),
    NOT_PARAM(6,100,"参数不匹配"),

    SERVER_DEVELOP_ERR(6,101,"开发者账号或密钥错误"),
    SERVER_ACCOUNT_USER_NAME_EXIST_ERR(6,102,"管理员账号名称已存在"),
    PROJECT_NOT_EXIST(6,103,"项目不存在"),
    PROJECT_IS_BANNED(6,104,"项目未启用"),
    SERVER_ADD_EQUIP_NAME_IS_EXIST(6,105,"该名称的设备已经存在"),
    SERVER_ADD_DEVICEUNIQUE_IS_NOTEXIST(6,106,"所添加的设备唯一码不存在"),
    SERVER_CHECKDEVELOPER_AUTH(6,107,"开发者没有项目权限或项目权限已过期"),
    SERVER_ADD_EQUIP_BUID(6,108,"至少添加一个楼栋地址"),
    SERVER_ADD_EQUIP_BUID_UNIT(6,109,"请检查设备类型和楼栋单元对应数目"),
    SERVER_PARSE_BUILDJSON_ERR(6,110,"解析buildJson异常"),
    SERVER_BUILDARR_FORMAT_ERR(6,111,"请检查buildArr格式或数量"),
    SERVER_PARSE_UNITJSON_ERR(6,112,"解析unitJson异常"),
    SERVER_UNITARR_FORMAT_ERR(6,113,"请检查unitArr格式或数量"),
    SERVER_MD5_ERROR(6,999,"MD5校验失败"),
    SERVER_SIGN_ERROR(6,998,"验签失败"),
    SERVER_ADD_USER_ROOM_ERR(6,112,"请至少添加一个用户"),
    SERVER_PARSE_USERJSON_ERR(6,113,"解析userJson异常"),
    SERVER_USER_PHONE_ERR(6,114,"用户手机号合格不正确"),
    SERVER_ROOM_ADDRESS_IS_EXIST(6,115,"请检查地址是否存在"),
    SERVER_PARSE_ROOMJSON_ERR(6,116,"解析roomJson异常"),
    SERVER_ROOMARR_FORMAT_ERR(6,117,"请检查roomArr格式或数量"),
    SERVER_PARSE_MEDIAJSON_ERR(6,118,"解析mediaJson异常"),
    SERVER_MEDIAARR_FORMAT_ERR(6,119,"请检查mediaArr格式或数量"),
    SERVER_PROJECT_USER_ISNOT_EXIST(6,120,"该项目下此用户不存在"),
    SERVER_GET_UNIT_BUILDNUM_ERR(6,121,"楼栋编号不能为空"),
    SERVER_NOT_EXIST_BUILDNUM_ERR(6,122,"楼栋编号或单元编号在该项目下不存在，请核实"),
    SERVER_UPLOAD_FILE_EMPTY_ERR(6,123,"上传文件不能为空或超过一个"),
    SERVER_UPLOAD_FILE_LONG_DISTANCE_ERR(6,124,"上传文件至远程服务器失败"),
    SERVER_SDK_DYPWD_ERR(6,125,"动态密码有效期不能超出最大值1440"),
    SERVER_SDK_FLOORNUM_ERR(6,126,"您所输入楼层数已超出本栋的最高楼层"),
    SERVER_SDK_PROJECT_BLING(6,127,"该项目未绑定第三方应用ID，请与我司相关人员联系"),
    SERVER_CHECKDEVELOPER_EXPIRE_AUTH(6,128,"您的权限开发者权限已经过期，请与我司相关人员联系"),
    SERVER_NOT_EXIST_ROOMNUM_ERR(6,129,"楼栋编号、单元编号或房间编号在该项目下不存在，请核实"),
    SERVER_SDK_USER_ACCOUNT_ERR(6,130,"您的账号已被禁用"),
    SERVER_SDK_ROBOT_ID_NO_AUTH_ERR(6,131,"开发者未授权该机器人"),
    SERVER_SDK_ROBOT_ID_NO_IDENTICAL_ERR(6,132,"机器人编号和登录时不一致"),

    ;

    @Setter
    @Getter
    private ErrorCode errorCode = new ErrorCode();


    CloudTalkErrorCodeEnum(){}
    @Getter
    private String codeMsg;



    /**
     * <desc>
     *     主错误码与错误信息构造函数
     * </desc>
     * @param mainCode
     * @param codeMsg
     */
    CloudTalkErrorCodeEnum(Integer mainCode, String codeMsg) {
        errorCode.setMainCode(mainCode);
        errorCode.setSubCode(0);
        errorCode.setCodeMsg(codeMsg);
    }

    /**
     * <desc>
     *     全参构造函数
     * </desc>
     * @param mainCode
     * @param subCode
     * @param codeMsg
     */
    CloudTalkErrorCodeEnum(Integer mainCode, Integer subCode, String codeMsg){
        this.codeMsg=codeMsg;
        errorCode.setMainCode(mainCode);
        errorCode.setSubCode(subCode);
        errorCode.setCodeMsg(codeMsg);
    }



}
